﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YiLe.Model.Domain;
using YiLe.DAL.Dao;
using NHibernate;
using NHibernate.Criterion;

namespace YiLe.DAL.NHibernate
{
    public class RoleDaoHibernate : BaseHibernate<Role, int>, RoleDao
    {
        public IList<Role> Search(Role role)
        {
            ICriteria criteria = Session.CreateCriteria<Role>();
            criteria.Add(Restrictions.Like("RoleName", "%" + role.RoleName + "%"));
            criteria.AddOrder(new Order("RoleID", true));
            return criteria.List<Role>();
        }
    }
}
